package com.kkwrite.regimen.gateway;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

/**
 * @author lisha
 */
@SpringCloudApplication
@EnableZuulProxy
public class RegProviderGatewayApp {
	private static final Logger logger = LoggerFactory.getLogger(RegProviderGatewayApp.class);
	private static final String PROFILE_TYPE_DEV = "dev";
	private static final String PROFILE_TYPE_PRO = "pro";

	public static void main(String[] args) {
		String profile = PROFILE_TYPE_DEV;
		if (args != null && args.length > 0) {
			profile = args[0];
		}
		logger.info("服务器启动获取到的命令行参数profile：{}", profile);
		if (!profile.equals(PROFILE_TYPE_DEV) && !profile.equals(PROFILE_TYPE_PRO)) {
			logger.warn("profile参数配置有误，使用默认配置dev");
			profile = PROFILE_TYPE_DEV;
		}

		new SpringApplicationBuilder(RegProviderGatewayApp.class)
				.profiles(profile)
				.run(args);
	}
}
